package com.lancoo.answer.helper;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import androidx.appcompat.app.AlertDialog;

import com.lancoo.answer.R;

public class NoConfirmDialogHelper {


    private static long subTime;

    /**
     * @param mContext context
     * @return AlertDialog
     */

    public static AlertDialog showDialog(Context mContext,
                                         String content){
        if(mContext==null){
            return null;
        }
        View inflate= LayoutInflater.from(mContext).inflate(R.layout.ev_dialog_no_confirm,null);
        AlertDialog.Builder builder=new AlertDialog.Builder(mContext,R.style.ev_dialogStyle);
        builder.setView(inflate);
        builder.setCancelable(false);
        final AlertDialog alertDialog = builder.create();
        alertDialog.show();
        Window window = alertDialog.getWindow();
        if(window==null){
            return alertDialog;
        }
        WindowManager.LayoutParams attributes = window.getAttributes();
        attributes.dimAmount=0.3f;
        alertDialog.getWindow().setAttributes(attributes);
        TextView tv_content = inflate.findViewById(R.id.tv_content);
        tv_content.setText(content);
        return alertDialog;
    }

}
